<template>
	<view class="top_nav_bar">
		<view class="statusBar"></view>
		<view class="top_nav_item">
			<view class="left_warp">
				<view class="goback" v-if="showback" @click="goback">
					<i class="iconfont iconzu4004"></i>
				</view>
				<view v-if="closeBtn" class="close" @click="closeBtnClick">关闭</view>
			</view>
			<slot name="middle" class="warp_text">
				<!-- <text>粉丝成长</text> -->
			</slot>
			<view class="right_warp" @click="right_btn">
				{{rightText}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			rightText:{
				type:String,
				default:''
			},
			showback:{
				type:Boolean,
				default:true
			},
			closeBtn:{
				type:Boolean,
				default:false
			},
			switchTab:{
				type:Boolean,
				default:false
			}
		},
		data() {
			return {

			};
		},
		methods:{
			goback(){
				if(this.switchTab){
					this.$emit('leftBtn');
					return false;
				};
				uni.navigateBack({});
			},
			right_btn(){
				this.$emit('rightBtn');
			},
			closeBtnClick(){
				this.$emit('closeBtn')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top_nav_bar{
		box-sizing: border-box;
		width: 100%;
		padding:0 24rpx 0 12rpx;
		position: sticky;
		top:0;
		z-index: 1000;
		color: #333;
		box-shadow: 0 2rpx 0 rgba($color: #E6E6E6, $alpha: 0.7);
		background-color: #fff;
		.top_nav_item{
			@include flex_align;
			font-size: 36rpx;
			font-weight: bold;
			height: 88rpx;
			.left_warp{
				display: flex;
				align-items: center;
				width: 140rpx;
				.goback{
					@include flex_center;
					flex-shrink: 0;
					width: 30rpx;
					height: 35rpx;
					padding:12rpx;
				}
				.close{
					font-size: 28rpx;
					margin-left: 10rpx;
				}
			}
			.right_warp{
				width: 140rpx;
				font-size: 28rpx;
				font-weight: normal;
				text-align: right;
				font-size: 28rpx;
			}
		}
	}
</style>
